<template>
  <div>
    <div class="wrapper">
      <Anchor :labelWidth="85">
        <div>
          <BreakSpace label="基础信息" :containerStyle="{ marginTop: '10px', marginBottom: '10px' }"></BreakSpace>
          <FormPanel
            ref="formPanel"
            :list="formList"
            :cols="2"
            :labelWidth="110"
            :formType="type"
            :isSubmitBtn="false"
            @formChange="formChangeHandle"
          />
        </div>
        <div id="row-03" class="line">
          <BreakSpace label="色彩配置" :containerStyle="{ marginTop: '10px', marginBottom: '10px' }"></BreakSpace>
          <FormPanel
            ref="formPanel1"
            :list="formList1"
            :cols="2"
            :labelWidth="110"
            :formType="type"
            :isSubmitBtn="false"
            @formChange="formChangeHandle"
          />


        </div>

        <div id="row-04" class="line">
          <BreakSpace label="服务间隔显示 (SIA)" :containerStyle="{ marginTop: '10px', marginBottom: '10px' }"></BreakSpace>
    <FormPanel
            ref="formPanel1"
            :list="formList2"
            :cols="2"
            :labelWidth="110"
            :formType="type"
            :isSubmitBtn="false"
            @formChange="formChangeHandle"
          />


        </div>


        <div id="row-05" class="line">
          <BreakSpace label="机油油位" :containerStyle="{ marginTop: '10px', marginBottom: '10px' }"></BreakSpace>
 <FormPanel
            ref="formPanel1"
            :list="formList3"
            :cols="2"
            :labelWidth="110"
            :formType="type"
            :isSubmitBtn="false"
            @formChange="formChangeHandle"
          />


        </div>

      </Anchor>
    </div>
    <div
      :style="{
        position: 'absolute',
        left: 0,
        bottom: 0,
        right: 0,
        zIndex: 9,
        borderTop: '1px solid #e9e9e9',
        padding: '10px 20px',
        background: '#fff',
        textAlign: 'right'
      }"
    >
      <el-button @click="closeHandler">关 闭</el-button>

    </div>
  </div>
</template>

<script>
// 数据字典/按钮权限
import { dictionary } from '@/utils/dictMixin';
import { authority } from '@/utils/authMixin';
import { notifyAction } from '@/utils';

// import { excuteCardInfo, getWtsList, getJpList, selectSPJ,getContractakingMethod } from '@/api/claimManagement/business/administration';
import { getIkeyFault } from '@/api/repair/queryStatistics/queryAccounts';

export default {
  name: '',
  mixins: [dictionary, authority],
  props:['type','editData','formData'],
  data() {
    return {
      formList: this.createFormList(),
      formList1: this.createFormList1(), // 色彩配置
      formList2: this.createFormList2(), // 色彩配置
      formList3: this.createFormList3(), // 色彩配置
      // fetchParams: {
      //   // 初始化查询参数
      //   wts: this.wts
      // },
    };
  },
  created() {},
  mounted() {
    this.init();
  },
  methods: {
   async init(){
     this.getIkeyFault();
    },
    async getIkeyFault(){
           console.log("++++++++++++++++++++++++++++++++++",this.formData);

     let data=this.formData;
    let keyFault=  await getIkeyFault({RO_NO:data[0].RO_NO,VIN:data[0].VIN});
      this.formList.find(x =>x.fieldName ==='BRAND').initialValue=keyFault.data.BRAND;
      this.formList.find(x =>x.fieldName ==='VIN').initialValue=keyFault.data.VIN;
      this.formList.find(x =>x.fieldName ==='MODEL_YEAR').initialValue=keyFault.data.MODEL_YEAR;
      this.formList.find(x =>x.fieldName ==='PRODUCT_DATE').initialValue=keyFault.data.PRODUCT_DATE;
      this.formList1.find(x =>x.fieldName ==='COLOR_CODE').initialValue=keyFault.data.COLOR_CODE;
    },
    createFormList() {
      return [
        {
          type: 'INPUT',
          label: '品牌',
          fieldName: 'BRAND',
          disabled: true,
          selfCols: 1
        },
        {
          type: 'INPUT',
          label: '底盘号',
          fieldName: 'VIN',
          disabled: true,
          selfCols: 1
        },
        {
          type: 'INPUT',
          label: '车型年份',
          fieldName: 'MODEL_YEAR',
          disabled: true,
          selfCols: 1
        },
        {
          type: 'INPUT',
          label: '说明',
          fieldName: 'SM',
          disabled: true,
          selfCols: 1
        },

        {
          type: 'INPUT',
          label: '销售型号',
          fieldName: 'pp',
          disabled: true,
          selfCols: 1
        },
        {
          type: 'DATE',
          label: '生产日期',
          fieldName: 'PRODUCT_DATE',
          disabled: true,
          selfCols: 1,
          dateFormat: 'yyyy-MM-dd'
        },

        {
          type: 'INPUT',
          label: 'MKB',
          fieldName: 'MKB',
          disabled: true,
          selfCols: 1
        },
        {
          type: 'DATE',
          label: '出厂日期',
          fieldName: 'CCRQ',
          disabled: true,
          selfCols: 1,
          dateFormat: 'yyyy-MM-dd'
        },

        {
          type: 'INPUT',
          label: 'GKB',
          fieldName: 'GKB',
          disabled: true,
          selfCols: 1
        },
        {
          type: 'INPUT',
          label: 'Leasing',
          fieldName: 'LEASING',
          disabled: true,
          selfCols: 1
        }
      ];
    },

    createFormList1() {
      return [
        {
          type: 'INPUT',
          label: '型号',
          fieldName: 'XH',
          disabled: true,
          selfCols: 1
        },
        {
          type: 'INPUT',
          label: '色码',
          fieldName: 'COLOR_CODE',
          disabled: true,
          selfCols: 1
        },
        {
          type: 'INPUT',
          label: '油漆编号',
          fieldName: 'YQBH',
          disabled: true,
          selfCols: 1
        },
        {
          type: 'INPUT',
          label: '说明',
          fieldName: 'SM',
          disabled: true,
          selfCols: 1
        }
      ];
    },
    createFormList2(){
      return [
        {
          type: 'INPUT',
          label: '服务间隔',
          fieldName: 'FWJG',
          disabled: true,
          selfCols: 1
        },
      ]

    },
     createFormList3(){
      return [
        {
          type: 'INPUT',
          label: '机油油位',
          fieldName: 'JYYW',
          disabled: true,
          selfCols: 1
        },
      ]

    },

    formChangeHandle() {},

    // 关闭面板
    closeHandler(type) {
      this.$emit('close', false);
      // this.$emit('close', false, type);
    }
  }
};
</script>

<style lang="less" scoped>
.wrapper {
  height: calc(100vh - 135px);
}
</style>
